import request from "@/utils/request";
import type { R, TopologyPageQry, TopologyDTO, PageDTO, TopologySaveCmd } from "@/types";

function getPage(qry: TopologyPageQry): Promise<R<PageDTO<TopologyDTO>>> {
  return request.get("/api/topology/page", { params: qry });
}

function getById(id: string): Promise<R<TopologyDTO>> {
  return request.get("/api/topology/get-by-id", { params: { id } });
}

function save(cmd: TopologySaveCmd): Promise<R<string>> {
  return request.post("/api/topology/save", cmd);
}

function deleteById(id: string): Promise<R<string>> {
  return request.post("/api/topology/delete", {}, { params: { id } });
}
export default {
  getPage,
  getById,
  save,
  deleteById
};
